﻿@model List<DatNuocViet.Models.New>

@{
    Layout = null;
    string lang = (Session["Language"] == null) ? "vi" : Session["Language"].ToString();
    string tab = "tab_" + (ViewBag.NewsTypeName as DatNuocViet.Models.NewsType).SortOrder.ToString();
    int id = (ViewBag.NewsTypeName as DatNuocViet.Models.NewsType).Id;
}
@helper Truncate(string input, int length)
{
    if (!string.IsNullOrEmpty(input))
    {
        if (input.Length <= length)
        {
            @input
        }
        else
        {
            @input.Substring(0, length)<text>...</text>
        }
    }
}
@helper FormatDatime(DateTime? date)
{
    DateTime result = (DateTime)date;
    
    @result.ToString("dd-MM-yyyy")
}

<div style="display: block;" class="news_content" id="@tab">
	
    <div class="news_item_content">
		
        @if (Model.Count >= 1)
        {  
            <div class="news_item">
		        <div class="news_item_img"><a href="@Url.Action("Details", "News", new { id = Model[0].Id })">
                <img src="@Model[0].Image" border="0" height="83" width="110"></a></div>
		        <div class="news_info">
			        <div class="news_title"><a href="@Url.Action("Details", "News", new { id = Model[0].Id })">@if (lang == "en") { @Html.Raw(Model[0].TitleEn); } else { @Html.Raw(Model[0].TitleVn); }</a> <br>
			        <strong>@FormatDatime(Model[0].CreateOn)</strong></div>
			        <div class="news_desc">@if (lang == "en") { @Html.Raw(Model[0].TitleEn); } else { @Html.Raw(Model[0].TitleVn); }</div>
		        </div>
		        <div class="clear"></div>
	        </div>
        }
        @if (Model.Count >= 2)
        {                        	
            <div class="news_item">
		        <div class="news_item_img"><a href="@Url.Action("Details", "News", new { id = Model[1].Id })">
                <img src="@Model[1].Image" border="0" height="83" width="110"></a></div>
		        <div class="news_info">
			        <div class="news_title"><a href="@Url.Action("Details", "News", new { id = Model[1].Id })">@if (lang == "en"){ @Html.Raw(Model[1].TitleEn);}else{ @Html.Raw(Model[1].TitleVn);}</a> <br>
			        <strong>@FormatDatime(Model[1].CreateOn)</strong></div>
			        <div class="news_desc">@if (lang == "en"){ @Html.Raw(Model[1].TitleEn);}else{ @Html.Raw(Model[1].TitleVn);}</div>
		        </div>
		        <div class="clear"></div>
	        </div>
        }							   
	</div>
					
	<div class="news_others">
		<div class="others_news_title"><strong>@DatNuocViet.Ultility.Helper.Label("text_cactinkhac")</strong></div>
		<div class="others_news_all"><a href="@Url.Action("Index", "News", new { id = id })">@DatNuocViet.Ultility.Helper.Label("text_xemtatca")</a></div>
		<div class="clear"></div>
		@if (Model.Count >= 3)
        {
            for (int i = 2; i < Model.Count; i++)
            {
            <div class="others_news_link"><a href="@Url.Action("Details", "News", new { id = Model[i].Id })">@if (lang == "en"){ @Html.Raw(Model[i].TitleEn);}else{ @Html.Raw(Model[i].TitleVn);}</a> 
            <strong>@FormatDatime(Model[i].CreateOn)</strong></div>					
            }  
      }
    </div>

	<div class="clear"></div>
</div>